Ubuntu 14.04
Sponsored Link

GlusterFS : Distributed + Replica
2014/05/31
 
Install Distributed Filesystem "GlusterFS".
For example, create a Distributed + Replica volume with 4 servers to be able to use it from GlusterFS Clients.
                                     +--------------------+           +--------------------+
                            10.0.0.60|                    |  10.0.0.62|                    |
                               +-----+ GlusterFS Server#1 |     +-----+ GlusterFS Server#3 |
+-----------------+            | eth0|                    |     | eth0|                    |
|                 |10.0.0.69   |     +--------------------+     |     +--------------------+
| GlusterFS Clint |------------+--------------------------------+
|                 |eth0        |     +--------------------+     |     +--------------------+
+-----------------+            | eth0|                    |     | eth0|                    |
                               +-----+ GlusterFS Server#2 |     +-----+ GlusterFS Server#4 |
                            10.0.0.61|                    |  10.0.0.63|                    |
                                     +--------------------+           +--------------------+

[1] Configure the same settings on 4 GlusterFS servers like follows. It is recommended to create a directory for GlusterFS volume on the different partition from the / partition.
root@gfs01:~#
apt-get -y install glusterfs-server
root@gfs01:~#
vi /etc/hosts
# add GlusterFS servers

10.0.0.60       gfs01.srv.world gfs01
10.0.0.61       gfs02.srv.world gfs02
10.0.0.62       gfs03.srv.world gfs03
10.0.0.63       gfs04.srv.world gfs04

# create a directory for GlusterFS volume

root@gfs01:~#
mkdir /glusterfs/dist-replica

[2] Work on a server like follows.
root@gfs01:~#
gluster peer probe gfs02
# search the server

peer probe: success
# just found

root@gfs01:~#
gluster peer probe gfs03
# search the server

peer probe: success
# just found

root@gfs01:~#
gluster peer probe gfs04
# search the server

peer probe: success
# just found

root@gfs01:~#
gluster peer status
# show status

Number of Peers: 3

Hostname: gfs02
Uuid: 0575e5a1-651b-49f4-80ee-06cd06f1740b
State: Peer in Cluster (Connected)

Hostname: gfs03
Port: 24007
Uuid: 62732bb1-c673-4840-825c-d4ffaf5f4b88
State: Peer in Cluster (Connected)

Hostname: gfs04
Port: 24007
Uuid: b1524234-b121-48b6-a233-61e287ce1ec7
State: Peer in Cluster (Connected)

# create a volume

root@gfs01:~#
gluster volume create vol_dist-replica replica 2 transport tcp \
gfs01:/glusterfs/dist-replica \
gfs02:/glusterfs/dist-replica \
gfs03:/glusterfs/dist-replica \
gfs04:/glusterfs/dist-replica

volume create: vol_dist-replica: success: please start the volume to access data
root@gfs01:~#
gluster volume start vol_dist-replica
# start the volume

volume start: vol_dist-replica: success
root@gfs01:~#
gluster volume info
# show info


Volume Name: vol_dist-replica
Type: Distributed-Replicate
Volume ID: fe74995f-bd6d-4aa4-8214-4d1c04b9afbb
Status: Started
Number of Bricks: 2 x 2 = 4
Transport-type: tcp
Bricks:
Brick1: gfs01:/glusterfs/dist-replica
Brick2: gfs02:/glusterfs/dist-replica
Brick3: gfs03:/glusterfs/dist-replica
Brick4: gfs04:/glusterfs/dist-replica
[3] Configure GlusterFS Clients to use GlusterFS volume from GlusterFS servers.
root@gfsclient:~#
apt-get -y install glusterfs-client
# mount the volume on /mnt

root@gfsclient:~#
mount -t glusterfs gfs01.srv.world:/vol_dist-replica /mnt
# just mounted

root@gfsclient:~#
df -h

Filesystem                            Size  Used Avail Use% Mounted on
/dev/mapper/dlp--vg-root              181G  1.1G  171G   1% /
none                                  4.0K     0  4.0K   0% /sys/fs/cgroup
udev                                  2.0G  4.0K  2.0G   1% /dev
tmpfs                                 395M  876K  394M   1% /run
none                                  5.0M     0  5.0M   0% /run/lock
none                                  2.0G     0  2.0G   0% /run/shm
none                                  100M     0  100M   0% /run/user
/dev/sda1                             236M   37M  188M  17% /boot
gfs01.srv.world:/vol_dist-replica   79G   56M   75G   1% /mnt
 
Tweet